<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title>${title}</title>
		<meta charset="utf-8">
		<#include "common/reference.ftl"/>
		<#include "common/ligerui.ftl"/>
		
		<script type="text/javascript">
		<!--
			$(function(){
				var treeMenus = $('#tree_menus').ligerTree({ 
												 url:'${base}/menu/getMenus',
												 textFieldName:'menuName',
												 idFieldName:'menuId',
												 parentIDFieldName:'parentId',
												 checkbox:false,
												 single:true,
												 onSelect:function(node){
												 	$('#parentId').val(node.data.menuId);
												 	$('#sortOrder').val(node.data.sortOrder+1);
												 }
											});
				$('#btnRoot').click(function(){
					$('#parentId').val(0);
				});
			});
		//-->
		</script>		
	</head>
	<body class="${configs["skinName"]}">
		<div class="page-content">
			<div class="row">
				<#include "common/breadcrumb.ftl">
				<form role="form" class="form-horizontal" method="post" action="${base}/${form_action}">
					<div class="col-xs-12 col-sm-5">
						<div class="widget-box">
							<div class="widget-header header-color-blue2">
								<h5 class="lighter">
									<i class="fa fa-tree"></i>
									菜单列表
								</h5>
								<div class="widget-toolbar no-border">
									<button id="btnRoot" class="btn btn-xs btn-purple" type="button">
										<i class="icon-cog"></i>
										顶级菜单
									</button>
								</div>
							</div>
							<div class="widget-body">
								<div id="tree_menus"></div>
							</div>
						</div>
					</div>
					<div class="col-xs-12 col-sm-5">
						<div class="widget-box">
							<div class="widget-header header-color-blue2">
								<h5 class="lighter">
									<i class="icon-table"></i>
									编辑菜单
								</h5>
							</div>
							<div class="widget-body">
								<input type="hidden" name="menuId" id="menuId" value="<#if model.menuId?exists>${model.menuId}</#if>">
								<input type="hidden" name="parentId" id="parentId" value="<#if model.parentId?exists>${model.parentId}</#if>">
								<div class="alert alert-warning">
									<strong>提示!</strong>
									如果没有选择菜单表示添加顶级菜单
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										菜单名称
									</label>
									<div class="col-sm-9">
										<input type="text" name="menuName" value="<#if model.menuName?exists>${model.menuName}</#if>">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										菜单地址
									</label>
									<div class="col-sm-9">
										<input type="text" name="actionUrl" value="<#if model.actionUrl?exists>${model.actionUrl}</#if>">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										图标样式
									</label>
									<div class="col-sm-9">
										<input type="text" name="iconCss" value="<#if model.iconCss?exists>${model.iconCss}</#if>">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										菜单描述
									</label>
									<div class="col-sm-9">
										<input type="text" name="menuDesc" value="<#if model.menuDesc?exists>${model.menuDesc}</#if>">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										排序
									</label>
									<div class="col-sm-9">
										<input type="text" name="sortOrder" value="<#if model.sortOrder?exists>${model.sortOrder}<#else>10</#if>">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										是否启用
									</label>
									<div class="col-sm-9">
										<input class="ace ace-switch ace-switch-5" type="checkbox" name="enabled" <#if model.enabled> checked="checked" </#if> >
										<span class="lbl"></span>
									</div>
								</div>
								<div class="clearfix form-actions">
									<div class="col-md-offset-3 col-md-9">
										<button id="btnSubmit" class="btn btn-info" type="submit">
											<i class="fa fa-check bigger-110"></i>
											提 交
										</button>
									</div>
								</div>
							</div>
						</div>
					</div>
			   </form>
		   </div>
	   </div>
	</body>
</html>